package com.chenfan.process.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chenfan.process.entity.po.TemplateConfigPo;
import com.chenfan.process.repository.TemplateConfigRepository;
import com.chenfan.process.service.TemplateConfigService;
import org.springframework.stereotype.Service;

/**
 * @author K
 * @date 2023/3/2 3:44 PM
 */
@Service
public class TemplateConfigServiceImpl extends ServiceImpl<TemplateConfigRepository, TemplateConfigPo> implements TemplateConfigService {

    @Override
    public TemplateConfigPo getByTemplateId(Long templateId, Long version) {
        LambdaQueryWrapper<TemplateConfigPo> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(TemplateConfigPo::getTemplateId, templateId);
        lambdaQueryWrapper.eq(TemplateConfigPo::getVersion, version);
        return this.getOne(lambdaQueryWrapper);
    }
}
